package com.kaoshidian.front.mongodb;

import com.kaoshidian.front.mongodb.base.BaseManage;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;

public class RecipeManager extends BaseManage {
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		RecipeManager manager = new RecipeManager();
		manager.mainBody("Recipe");
	}

	@Override
	public void treate(DBCollection coll) {
		DBCursor cur = coll.find();
		while (cur.hasNext()) {
			DBObject obj = cur.next();
			String signtop = (String) obj.get("recipeIsCool");
			if (signtop == null || signtop.equals("COMMON")) {
				obj.put("recipeIsCool", "UN_COOL");
			}
			String recommend = (String) obj.get("recipeIsRecommend");
			if (recommend == null || recommend.equals("NO_RECOMMEND")) {
				obj.put("recipeIsRecommend", "UN_RECOMMEND");
			}
			String verify = (String) obj.get("verify");
			if (verify == null || verify.equals("NO_VERIFY")) {
				obj.put("verify", "UN_VERIFY");
			}
			
			coll.save(obj);
		}
	}

}
